package com.yl.ylnews.utils;

import android.content.Context;
import android.content.SharedPreferences;

import static android.content.Context.MODE_PRIVATE;

/**
 * Created by Administrator on 2016/10/15 0015.
 */

public class PrefUtil {
    public static boolean getSharedPerenceBoolean(Context context, String key, boolean delValue) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        return sp.getBoolean(key, delValue);
    }

    public static void setSharedPerenceBoolean(Context context, String key, boolean value) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        sp.edit().putBoolean(key, value).commit();
    }

    public static int getSharedPerenceInt(Context context, String key, int delValue) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        return sp.getInt(key, delValue);
    }

    public static void setSharedPerenceInt(Context context, String key, int value) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        sp.edit().putInt(key, value).commit();
    }

    public static String getSharedPerenceString(Context context, String key, String delValue) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        return sp.getString(key, delValue);
    }

    public static void setSharedPerenceString(Context context, String key, String value) {
        SharedPreferences sp = context.getSharedPreferences("config", MODE_PRIVATE);
        sp.edit().putString(key, value).commit();
    }


}
